#include "Loader.c"
#include "UI.c"
#include "WordResolver.c"

//global variables used in Loader, WordResolver, WordAdder
unsigned int *words, *indicies;
//may be a really damn long word lol

sub buttonClicked(byval sender as object, e as eventArgs) handles...
	Dim btnClikd As String = sender.text.ToString.Substring(0, 1) //not important for the port, basically got the first letter of the button clicked to identify which one was clicked
	Select Case btnClikd
		Case "N"	//next
			If match Then
				screeen.Text = screeen.Text.Substring(0, screeen.Text.Length - curCod.ToString.Length) & getword(curElement)
				Exit Sub
			End If
		Case "S"	//space
			curCod = 0
			screeen.Text &= " "
			Exit Select
		Case "C"	//clear
			screeen.Text = screeen.Text.Substring(0, screeen.Text.Length - 1)
			If curCod.ToString.Length > 1 Then
				curCod = CInt(curCod.ToString.Substring(0, curCod.ToString.Length - 1))
			Else
				curCod = 0
			End If
			Exit Select
		Case else
			If curCod = 0 Then
				curCod = CInt(btnClikd)
			Else						//for this block, im envying >> and << operators about now ;)
				curCod *= 10
				curCod += CInt(btnClikd)
			End If
			screeen.Text &= btnClikd	//just display something so they know whats going on
			Exit Select
	End Select

	If getword(-1) <> Nothing Then
		screeen.Text = screeen.Text.Substring(0, screeen.Text.Length - curCod.ToString.Length) & getword(-1)
	End If
end sub